<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 联想小鑫
  Date: 2021/11/12
  Time: 9:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" href="css/img.css">
</head>
<body>
<form action="list.do" method="post">
    房主姓名: <input type="text" name ="hname" value="${hname}"> <br>
    房屋地址: <input type="text" name ="haddress" value="${haddress}"> <br>
    <input type="submit" value="查询">
</form>
<table border="1">
    <tr>
        <td></td>
        <td>房产编号</td>
        <td>房主姓名</td>
        <td>坐落地址</td>
        <td>用途</td>
        <td>面积</td>
        <td>图片</td>
        <td><button onclick="addt()">添加</button></td>
    </tr>
    <c:forEach items="${list}" var="s">
        <tr>
            <td>
                <input type="checkbox" value="${s.hid}">
            </td>
            <td>${s.hid}</td>
            <td>${s.onames}</td>
            <td>${s.haddress}</td>
            <td>${s.huse}</td>
            <td>${s.harea}</td>
            <td>
                <img src="${s.hpic}" alt="该图片无法展示" width="75px">
            </td>
            <td>
                <button class="xg" value="${s.hid}">修改</button>
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="10" align="center">
            第${page.getPageNum()}页/共${page.getPages()}页
            <button onclick="go(1)">首页</button>
            <button onclick="go(${page.getPageNum()}-1)">上一页</button>
            <button onclick="go(${page.getPageNum()}+1)">下一页</button>
            <button onclick="go(${page.getPages()})">未页</button>
        </td>
    </tr>
</table>
</body>
<script>
    function go(pageNum) {
        location="list.do?pageNum="+pageNum+"&"+$("form").serialize();
    }
    function addt() {
        location="addy.do";
    }
    $(".xg").click(function () {
        location="updy.do?id="+$(this).val();
    })
</script>
</html>
